<template>
	<view>
		<u-navbar title="班级" bgColor="transparent" :autoBack="true" :fixed="false"></u-navbar>
		<view class="p-30" style="padding: 0 30rpx;" v-if="!noData">
			<navigator :url="`/pages/teacher/student?banji_id=${item.id}`" class="card p-30 mt-30 gray-color"
				v-for="(item,index) in list">
				班级名称：{{item.name}}
			</navigator>
		</view>
		<template v-else>
			<u-empty marginTop="60" mode="data">
			</u-empty>
		</template>
	</view>
</template>

<script>
	import {
		banjiList
	} from '@/common/api.js'
	import commonMixin from '@/mixins/common.js';
	export default {
		mixins: [commonMixin],
		data() {
			return {
				status: 'loading',
				list: [],
				noData: false,
				page: 1,
				total: 0
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				this.status = "loading";
				this.list = [];
				this.page = 1;
				this.noData = false;
				this.getList();
			},
			getList() {
				let vm = this;
				let params = {
					'page': this.page,
					'limit': this.$u.config.limit
				};
				banjiList({
					params
				}).then(res => {
					console.log(res);
					if (res.length != 0) {
						this.noData = false;
						this.list = res
					} else {
						this.noData = true;
						this.status = "nomore"
					}
				}).catch(err => {
					vm.$refs.uToast.show({
						type: 'error',
						message: err.message,
						complete() {
							vm.loading = false;
						}
					})
				})
			}
		}
	}
</script>


<style>
</style>